<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div >
        <el-form size="small" label-width="90px" :rules="rules" ref="form" :model="crud.order"
                 :disabled="crud.order.orderStatus==='PASS'" >
          <el-row :gutter="10">
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="单据编码">
              <el-input  v-model="crud.order.code" disabled placeholder="系统自动生成"></el-input>
            </el-form-item>
          </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="业务日期">
                <div class="flex flex-row">
                  <el-date-picker
                    v-model="crud.order.busDate"
                    align="right"
                    unlink-panels
                    class="fl1"
                    format="yyyy - MM - dd "
                    value-format="yyyy-MM-dd"
                    default-value
                    range-separator=""
                    placeholder="开始日期"
                    style="width:  100%"
                  />
                </div>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="供应商" prop="customerId">
                <zSelect :value.sync="crud.order.customerId" :showName="crud.order.customerName" @getChange="getInfo" :disabled="crud.order.orderStatus==='PASS'" url="api/dropDown/basCustomerList"  :params="{isContact:'1,2'}"
                         style="width:  100%"/>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="状态">
              <el-select
                v-model="crud.order.orderStatus"
                class="filter-item"
                clearable
                disabled
                placeholder="状态"
                size="small"
                style="width: 100%;"
              >
                <el-option
                  v-for="item in dict.common_order_status"
                  :key="item.id"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="产品名称" prop="goodsId">
              <jtg-select-plus  ref="productRef"
                                v-model="crud.order.goodsId"
                                :initValue="crud.order.goodsName"
                                @getChangeInfo="getInputMation($event)"
                                :disabled="crud.order.orderStatus==='PASS'"
                                url="productList"/>
            </el-form-item>
          </el-col>
            <el-col :span="6">
              <el-form-item label="辅数量" prop="boxNum">
                <div class="flex flex-row" >
                  <el-input
                            maxlength="12"
                            v-model="crud.order.boxCount"
                            style="width:50%;float: left"
                            @change="changeNum(5)"
                            :disabled="crud.order.orderStatus==='PASS'"
                            placeholder="">
                    <template slot="append">箱</template>
                  </el-input>
                  <el-input
                            maxlength="12"
                            v-model="crud.order.mainNum"
                            style="width: 50%;float: right"
                            @change="changeNum(5)"
                            :disabled="crud.order.orderStatus==='PASS'"
                            placeholder="">
                    <template slot="append">瓶</template>
                  </el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="箱价">
                <el-input type="number"  v-model="crud.order.taxBoxPrice" @change="changeNum(4)" :disabled="crud.order.orderStatus==='PASS'"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="数量" prop="goodsCount">
                <el-input-number style="width: 100%"  v-model="crud.order.goodsCount" @change="changeNum(1)" :disabled="crud.order.orderStatus==='PASS'"   placeholder=""></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
            <el-row :gutter="10">
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="单价">
                <el-input type="number"  v-model="crud.order.taxPrice" @change="changeNum(2)" :disabled="crud.order.orderStatus==='PASS'"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="金额">
                <el-input type="number"  v-model="crud.order.taxAmount" @change="changeNum(3)" :disabled="crud.order.orderStatus==='PASS'"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="拆装类型">
                <el-select v-model="crud.order.type" class="edit-input" placeholder="请选择" style="width:100%">
                  <el-option
                    v-for="(item,index) in dict.t_ware_split_order_type "
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="可用量">
                <el-input type="number" disabled  v-model="crud.order.usableNum"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="入库仓库" prop="inWarehouseId">
                <zSelect :value.sync="crud.order.inWarehouseId" :showName="crud.order.inWarehouseName" @getChange="getInfoInWare"  :disabled="crud.order.orderStatus==='PASS'"  url="api/dropDown/basWarehouseList"
                         style="width:  100%"/>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="入库库区">
                <zSelect :value.sync="crud.order.inLocationId" :disabled="crud.order.orderStatus==='PASS'"  :params="{warehouseId:crud.order.inWarehouseId}" url="api/dropDown/basLocationList" />
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="入库库位">
                <zSelect :value.sync="crud.order.inStorehouseId" :disabled="crud.order.orderStatus==='PASS'"  :label="crud.order.storehouseName" :params="{warehouseId:crud.order.inWarehouseId}" url="api/dropDown/basStorehouseList"/>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="出库仓库" prop="outWarehouseId">
                <zSelect     style="width: 100%" @getChange="getInfoOutWare" :showName="crud.order.outWarehouseName" :value.sync="crud.order.outWarehouseId" :disabled="crud.order.orderStatus==='PASS'"  url="api/dropDown/basWarehouseList" />
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="出库库区">
                <zSelect :value.sync="crud.order.outLocationId" :disabled="crud.order.orderStatus==='PASS'"  :params="{warehouseId:crud.order.outWarehouseId}" url="api/dropDown/basLocationList" />
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="出库库位">
                <zSelect :value.sync="crud.order.outStorehouseId" :disabled="crud.order.orderStatus==='PASS'"  :label="crud.order.storehouseName" :params="{warehouseId:crud.order.outWarehouseId}" url="api/dropDown/basStorehouseList"/>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="未税成本金额">
                <el-input type="costNoTaxAmount" disabled  v-model="crud.order.costNoTaxAmount"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="未税成本单价">
                <el-input type="costNoTaxPrice" disabled  v-model="crud.order.costNoTaxPrice"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="含税成本金额">
                <el-input type="costTaxAmount" disabled  v-model="crud.order.costTaxAmount"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="含税成本单价">
                <el-input type="costTaxPrice" disabled  v-model="crud.order.costTaxPrice"   placeholder=""></el-input>
              </el-form-item>
            </el-col>
          </el-row>

        </el-form>
      </div>
      <!--   操作栏   -->
      <div >
        <el-button
          slot="left"
          class="filter-item"
          size="mini"
          :disabled="crud.order.orderStatus==='PASS'"
          type="primary"
          @click="toAdd()"
        >
          新增
        </el-button>
        <!--        <el-button-->
        <!--          slot="left"-->
        <!--          class="filter-item"-->
        <!--          size="mini"-->
        <!--          type="success"-->
        <!--          :disabled="crud.selections.length !== 1"-->
        <!--          @click="toDeatil(crud.selections)"-->
        <!--        >修改-->
        <!--        </el-button>-->
<!--        <el-button-->
<!--          slot="right"-->
<!--          class="filter-item"-->
<!--          size="mini"-->
<!--          @click="crud.toCopy($route.params.id,'/ware/wareSplitOrderDetail')"-->
<!--          v-permission="permission.copy"-->
<!--        >-->
<!--          复制-->
<!--        </el-button>-->
        <el-button
          slot="right"
          class="filter-item"
          size="mini"
          :disabled="crud.order.orderStatus==='PASS' "
          type="primary"
          @click="submit()"
        >
          保存
        </el-button>
        <el-button
          slot="right"
          class="filter-item"
          size="mini"
          type="success"
          :disabled="$route.params.id=='null'|| $route.params.id == 'add'"
          :loading="crud.passLoading"
          @click="crud.doDetailPassOrReject('PASS',id)"

        >
          <!--        v-permission="permission.pass"-->
          审核
        </el-button>
        <el-button
          slot="right"
          class="filter-item"
          size="mini"
          type="info"
          :loading="crud.rejectLoading"
          :disabled="$route.params.id=='null' || $route.params.id == 'add'"
          @click="crud.doDetailPassOrReject('REJECT',id)"

        >
          <!--        v-permission="permission.reject"-->
          反审
        </el-button>
          <el-button
            slot="right"
            class="filter-item"
            size="mini"
            type="primary"
            @click="toAddList">
            批量新增
          </el-button>
<!--        <el-button-->
<!--          slot="right"-->
<!--          class="filter-item"-->
<!--          size="mini"-->
<!--          type="info"-->
<!--          :loading="crud.rejectLoading"-->
<!--          :disabled="$route.params.id=='null'"-->
<!--          @click="crud.doDetailPassOrReject('REJECT',id)"-->

<!--        >-->
<!--          &lt;!&ndash;        v-permission="permission.reject"&ndash;&gt;-->
<!--          消息通知-->
<!--        </el-button>-->
      </div>
      <!--      :summary-method="crud.getSummaries"-->
      <el-dialog
        title="请选择打印模板"
        :visible.sync="crud.printConfig.pringDialog"
        width="30%"
      >
        <jPrintConfig groupId="buyOrder"
                      v-if="crud.printConfig.pringDialog"
                      @getPrintId="crud.detailedPrint"
                      :isPreview="crud.printConfig.isPreview"
        ></jPrintConfig>
      </el-dialog>
      <vue-context-menu :contextMenuData="contextMenuData"
                        @tableConfig="tableConfig"
                        @deletedata="deletedata"></vue-context-menu>
      <!-- 表格配置 -->
      <el-dialog title="表格配置"
                 :visible.sync="tableConfigShow"
                 width="60%">
        <j-table-column-config :columns.sync="crud.header"  @tabSave="tabSave" @pit="pit" />
      </el-dialog>
      <el-table ref="table" row-class-name="crud.tableRowClassName"
                v-if="isShowTable"
                @header-dragend="changeColWidth"
                @contextmenu.native="showMenu"
                highlight-current-row="highlight-current-row"
                @row-dblclick="switchRowIndex"
                height="500px"
                :data="crud.data"
                size="small" style="width: 100%;"
                :show-summary="true"
                :summary-method="crud.sumRow"
                sortable="custom"
                border
                @row-click="crud.selectRow"
                :row-style="crud.rowClass"
                :row-class-name="crud.tableRowClassName"
                @sort-change="crud.sortChange"
                @selection-change="crud.selectionChangeHandler">

        <el-table-column :render-header="crud.renderHeader" type="selection" width="60" />
        <el-table-column :render-header="crud.renderHeader" type="index" width="60" label="序号"/>
        <el-table-column
          v-if="item.visible"
          v-for="(item, index) in crud.header"
          :key="`col_${index}`"
          :prop="item.prop"
          :label="columnLabel(item)"
          :width="item.width + 'px'"
          :data-porp='item.prop'
          @contextmenu.native="showMenu"
          @header-dragend="changeColWidth"
        >
          <!-- 自定义渲染模版 -->
          <template slot-scope="scope">
            <!-- 当列key为 sort 时，渲染一个手柄icon -->
            <template v-if="item.prop =='sort'">
              <div class="handle_move">
                <i :class="scope.row['sort']" />
              </div>
            </template>
            <template v-else>
              <span v-if="item.type == 1" style="margin-left: 0px">{{scope.row[`${item.prop}`]}}</span>
              <span v-else-if="item.type == 2" style="margin-left: 0px">{{ parseTime(scope.row[`${item.prop}`])}}</span>
              <span v-else-if="item.type == 3" style="margin-left: 0px">{{ getDict(`this.dict.label.${item.dictionary}["${scope.row[item.prop]}"]`) }}</span>
              <span v-else-if="item.type == 4" >
                <span v-if="item.prop == 'goodsName'" class="flex a-item" >
                <span   v-if="scope.$index !== rowIndex || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.goodsName }}</span>
                <jtg-select-plus v-else ref="productRef"
                                 v-model="scope.row.goodsId"
                                 :initValue="scope.row.goodsName"
                                 :customerId="crud.order.customerId"
                                 :type="crud.order.type"
                                 :buyChannel ="2"
                                 @remoteMethod="getValue($event,scope.$index)"
                                 @input="getInput($event,scope.row.goodsName,scope.$index)"
                                 @change="crud.productChange($event,scope)"
                                 url="productList"/>
                </span>
                <span v-else-if="item.prop == 'goodsTagName'" style="display: flex;justify-content: center;align-items: center" >
              <span v-if="scope.$index !== rowIndex || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.goodsTagName }}</span>
                <zSelect v-else :value.sync="scope.row.goodsTagId" :label="scope.row.goodsTagName"    @change="crud.setProduct($event,scope,'goodsTagName')" url="api/dropDown/basGoodsTagList"    style="width: 100%;"/>
              </span>
               <span v-else-if="item.prop == 'goodsCount'" style="display: flex;justify-content: center;align-items: center"  >
              <span v-if="scope.$index !== rowIndex  || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.goodsCount }}</span>
                  <el-input  v-else
                            @input.native="crud.inuptCount(scope, 'goodsCount')"
                            oninput="value=value.replace(/[^\d^\.]/g,'')"
                            v-model.lazy="scope.row.goodsCount"
                            style="width: 100%"/>
               </span>
                 <span v-else-if="item.prop == 'taxPrice'" style="display: flex;justify-content: center;align-items: center" >
                 <span v-if="scope.$index !== rowIndex  || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.taxPrice }}</span>
                  <el-input  v-else
                            @input.native="crud.inuptCount(scope, 'taxPrice')"
                            oninput="value=value.replace(/[^\d^\.]/g,'')"
                            v-model.lazy="scope.row.taxPrice"
                            style="width: 100%"/>
            </span>
            <span v-else-if="item.prop == 'taxBoxPrice'" style="display: flex;justify-content: center;align-items: center" >
                 <span v-if="scope.$index !== rowIndex  || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.taxBoxPrice }}</span>
                  <el-input  v-else
                            @input.native="crud.inuptCount(scope, 'taxBoxPrice')"
                            oninput="value=value.replace(/[^\d^\.]/g,'')"
                            v-model.lazy="scope.row.taxBoxPrice"
                            style="width: 100%"/>
                  </span>
<!--             <span v-else-if="item.prop == 'boxCount'" style="display: flex;justify-content: center;align-items: center" >-->
<!--                 <span v-if="scope.$index !== rowIndex  || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.boxCount }}</span>-->
<!--                <el-input  v-else-->
<!--                          @input.native="crud.inuptCount(scope, 'boxCount')"-->
<!--                          oninput="value=value.replace(/[^\d^\.]/g,'')"-->
<!--                          v-model.lazy="scope.row.boxCount"-->
<!--                          style="width: 100%"/>-->
<!--            </span>-->
            <span v-else-if="item.prop == 'boxNum'"  style="display: flex;justify-content: center;align-items: center" >
            <span v-if="scope.$index !== rowIndex  || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.boxNum || 0 }}{{ scope.row.boxUnitName }}</span>
            <el-input v-else
                      @input.native="crud.inuptCount(scope, 'boxNum')"
                      maxlength="12"
                      v-model="scope.row.boxNum"
                      style="width:50%;float: left">
              <div slot="suffix" style="height: 100%;font-size: 15px;color: black" class="flex a-item j-content">{{scope.row.boxUnitName}}</div>
            </el-input>
              <span v-if="scope.$index !== rowIndex || crud.order.orderStatus==='PASS'||crud.order.orderStatus==='CLOSE'">{{ scope.row.mainNum || 0  }}{{ scope.row.mainUnitName }}</span>
                <el-input v-else
                          @input.native="crud.inuptCount(scope, 'mainNum')"
                          maxlength="12"
                          v-model="scope.row.mainNum"
                          style="width:50%;float: right">
                  <div slot="suffix" style="height: 100%;font-size: 15px;color: black" class="flex a-item j-content">{{scope.row.mainUnitName}}</div>%
                </el-input>
              </span>

              </span>
            </template>
          </template>
        </el-table-column>

        <!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsCode')" prop="goodsCode" label="商品编码" />-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsName')" prop="goodsName" label="商品名称" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.goodsName }}</span>-->
<!--            <jtg-select-plus v-else ref="productRef"-->
<!--                             v-model="scope.row.goodsId"-->
<!--                             :initValue="scope.row.goodsName"-->
<!--                             :customerId="crud.order.customerId"-->
<!--                             :type="crud.order.type"-->
<!--                             :buyChannel ="2"-->
<!--                             @remoteMethod="getValue($event,scope.$index)"-->
<!--                             @input="getInput($event,scope.row.goodsName,scope.$index)"-->
<!--                             @change="crud.productChange($event,scope)"-->
<!--                             url="productList"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsTypeName')" prop="goodsTypeName" label="商品分类" />-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsBrandName')" prop="goodsBrandName" label="商品品牌" />-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsTagName')" prop="goodsTagName" label="商品类型" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.goodsTagName }}</span>-->
<!--            <zSelect v-else :value.sync="scope.row.goodsTagId" :label="scope.row.goodsTagName"    @change="crud.setProduct($event,scope,'goodsTagName')" url="api/dropDown/basGoodsTagList"    style="width: 100%;"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('model')" prop="model" label="规格型号" />-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('mainUnitName')" prop="mainUnitName" label="单位" >-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('model')" prop="model" label="换算率" />-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('usableNum')" prop="usableNum" label="可用量" >-->
<!--          <template slot-scope="scope">-->
<!--            <span >{{ scope.row.usableNum }}</span>-->
<!--&lt;!&ndash;            <el-input v-if="scope.row.isSelected"&ndash;&gt;-->
<!--&lt;!&ndash;                      @input.native="crud.inuptCount(scope, 'usableNum')"&ndash;&gt;-->
<!--&lt;!&ndash;                      oninput="value=value.replace(/[^\d^\.]/g,'')"&ndash;&gt;-->
<!--&lt;!&ndash;                      maxlength="12"&ndash;&gt;-->
<!--&lt;!&ndash;                      v-model.lazy="scope.row.usableNum"&ndash;&gt;-->
<!--&lt;!&ndash;                      style="width: 100%"/>&ndash;&gt;-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('goodsCount')" prop="goodsCount" label="数量" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.goodsCount }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'goodsCount')"-->
<!--                      oninput="value=value.replace(/[^\d^\.]/g,'')"-->
<!--                      v-model.lazy="scope.row.goodsCount"-->
<!--                      style="width: 100%"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('taxBoxPrice')" prop="taxBoxPrice" label="箱价" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.taxBoxPrice }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'taxBoxPrice')"-->
<!--                      oninput="value=value.replace(/[^\d^\.]/g,'')"-->
<!--                      v-model.lazy="scope.row.taxBoxPrice"-->
<!--                      style="width: 100%"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('boxCount')" prop="boxCount" label="箱数" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.boxCount }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'boxCount')"-->
<!--                      oninput="value=value.replace(/[^\d^\.]/g,'')"-->
<!--                      v-model.lazy="scope.row.boxCount"-->
<!--                      style="width: 100%"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('taxPrice')" prop="taxPrice" label="单价" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.taxPrice }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'taxPrice')"-->
<!--                      oninput="value=value.replace(/[^\d^\.]/g,'')"-->
<!--                      v-model.lazy="scope.row.boxCount"-->
<!--                      style="width: 100%"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader"  v-if="columns.visible('boxNum')" prop="boxNum" label="辅数量" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.boxNum }}{{ scope.row.boxUnitName }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'boxNum')"-->
<!--                      maxlength="12"-->
<!--                      v-model="scope.row.boxNum"-->
<!--                      style="width: 45%;float: left">-->
<!--              <template slot="append">{{scope.row.boxUnitName}}</template>-->
<!--            </el-input>-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.mainNum }}{{ scope.row.mainUnitName }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      @input.native="crud.inuptCount(scope, 'mainNum')"-->
<!--                      maxlength="12"-->
<!--                      v-model="scope.row.mainNum"-->
<!--                      style="width: 45%;float: right">-->
<!--              <template slot="append">{{scope.row.mainUnitName}}</template>-->
<!--            </el-input>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('outLocationId')" prop="outLocationId" label="出库库区" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.outLocationName }}</span>-->
<!--            <zSelect v-if="scope.row.isSelected" :value.sync="scope.row.outLocationId"  url="api/dropDown/basLocationList" />-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('outStorehouseId')" prop="outStorehouseId" label="出库库位" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.outStorehouseName }}</span>-->
<!--            <zSelect v-if="scope.row.isSelected" :value.sync="scope.row.outStorehouseId"  url="api/dropDown/basStorehouseList"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('inLocationId')" prop="inLocationId" label="入库库区" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.inLocationName }}</span>-->
<!--            <zSelect v-if="scope.row.isSelected" :value.sync="scope.row.inLocationId"  url="api/dropDown/basLocationList" />-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('inStorehouseId')" prop="inStorehouseId" label="入库库位" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.inStorehouseName }}</span>-->
<!--            <zSelect v-if="scope.row.isSelected" :value.sync="scope.row.inStorehouseId"  url="api/dropDown/basStorehouseList"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('remark')" prop="remark" label="备注" >-->
<!--          <template slot-scope="scope">-->
<!--            <span v-if="!scope.row.isSelected">{{ scope.row.remark }}</span>-->
<!--            <el-input v-if="scope.row.isSelected"-->
<!--                      v-model.lazy="scope.row.remark"-->
<!--                      style="width: 100%"/>-->
<!--          </template>-->
<!--        </el-table-column>-->
        <!--        v-permission="['admin','buyProtocolDetail:edit','buyProtocolDetail:del']"-->
        <el-table-column :render-header="crud.renderHeader"  label="操作" fixed="right" width="150px" align="center">
          <template slot-scope="scope">
            <!--              <el-button-->
            <!--                type="primary"-->
            <!--                icon="el-icon-plus"-->
            <!--                circle-->
            <!--                v-if="(crud.data.length-1)==scope.$index"-->
            <!--                :disabled="crud.order.orderStatus==='PASS'"-->
            <!--                @click="crud.addRow(scope.$index)"></el-button>-->
            <!--              v-if="crud.data.length!==1"-->
            <el-button
              slot="reference" class="el-icon-delete opration_icon_btn"
              :disabled="crud.order.orderStatus==='PASS'"
              style="border: none;width: auto;height: auto"
              @click="delAddRow(scope.$index)"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <!--      <pagination />-->
      <!--批量新增弹窗-->
      <el-dialog :close-on-click-modal="false" title="商品新增"
                 :visible.sync="showAddBatchDialog" append-to-body width="100vw">
        <add-batch v-if="showAddBatchDialog" :showAddBatchDialog.sync="showAddBatchDialog" :list="detailList"
                   :params="{customerId:crud.order.customerId,type:crud.order.type==1?'BUY':'BUY_RETURN',}"
                   @change="afterChangeGoods"></add-batch>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import crudWareSplitOrder from '@/api/erp/wareSplitOrder'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import jtgSelectPlus from '@/components/select/JtgSelectPlus'
import { getCompany } from '@/api/system/company'
import {Notification} from "element-ui";
import addBatch from '@/components/addBatch/addBatch'
import jPrintConfig from "../../../components/jPrintConfig/jPrintConfig";
import {salesDetailKey} from "@/utils/key";
import { publicListKey } from "@/utils/key";
import {getHeaderProperties} from "@/api/erp/headerProperties";
import {tablemixins} from "@/mixins/tablemixins";
import  jTableColumnConfig  from "@/components/jTableColumnConfig/jTableColumnConfig";

// crud交由presenter持有
const defaultCrud = CRUD({ title: '拆装单单明细',
  params() {
    const href = location.href.split('/')
    if(href[5].includes('copyId')){
      return {
        id: 0,
      }
    }else{
      return {
        id: href[href.length - 1] == 'add' ? 0 : href[href.length - 1],  page: 0, size: 999,
      }
    }
  },
  url: 'api/wareSplitOrder/detail',name:'wareSplitOrder', sort: 't.seq,asc', crudMethod: { ...crudWareSplitOrder }})
const defaultForm = { id: null, orderId: null, goodsId: null, goodsCode: null, goodsName: null, barcode: null, boxBarcode: null, helpSign: null, model: null, goodsBrandId: null, goodsBrandCode: null, goodsBrandName: null, goodsTypeId: null, goodsTypeCode: null, goodsTypeName: null, goodsTagId: null, goodsTagCode: null, goodsTagName: null, taxId: null, taxCode: null, taxName: null, taxRate: null, firstUnitId: null, firstUnitCode: null, firstUnitName: null, firstUnitCount: null, effectGoodsCount: null, cutOffGoodsCount: null, taxPrice: null, noTaxPrice: null, taxBoxPrice: null, noTaxBoxPrice: null, seq: null, remark: null, createUserId: null, createUserCode: null, createUserName: null, createTime: null, updateUserId: null, updateUserCode: null, updateUserName: null, updateTime: null }
const copyFrom = Object.assign({},defaultForm)
export default {
  name: 'wareSplitOrderDetail',
  components: { pagination, crudOperation, rrOperation, udOperation,jtgSelectPlus,addBatch,jPrintConfig,jTableColumnConfig},
  mixins: [presenter(defaultCrud), header(), form(defaultForm), crud(),publicListKey,tablemixins,salesDetailKey],
  dicts: ['t_ware_split_order_type','common_yes_or_no','t_buy_order_type','common_order_status','t_buy_order_buy_channel',],

  updated() {
    this.$nextTick(() => {
      this.$refs.table.doLayout()
    })
  },
  data() {
    return {
      id: null,
      copyFrom: null,
      permission: {
        add: ['admin', 'wareSplitOrderDetail:add'],
        edit: ['admin', 'wareSplitOrderDetail:edit'],
        del: ['admin', 'wareSplitOrderDetail:del'],
        import: ['admin', 'wareSplitOrderDetail:import'],
        export: ['admin', 'wareSplitOrderDetail:export'],
        copy: ['admin', 'wareSplitOrderDetail:copy'],
        upload: ['admin', 'wareSplitOrderDetail:upload'],
        download: ['admin', 'wareSplitOrderDetail:download'],
      },
      rules: {
        goodsId: [
          { required: true, message: '产品名称不能为空', trigger: 'blur' }
        ],
        outWarehouseId: [
          { required: true, message: '出库仓库不能为空', trigger: 'blur' }
        ],
        inWarehouseId: [
          { required: true, message: '入库仓库不能为空', trigger: 'blur' }
        ],
        goodsCount: [
          { required: true, message: '数量不能为空', trigger: 'blur' }
        ],
        // sourceType: [
        //   { required: true, message: '来源类型不能为空', trigger: 'blur' }
        // ],
        customerId: [
          { required: true, message: '供应商不能为空', trigger: 'blur' }
        ],
        userId: [
          { required: true, message: '业务员不能为空', trigger: 'blur' }
        ],
        isAppend: [
          { required: true, message: '是否追加不能为空', trigger: 'blur' }
        ],
        isContact: [
          { required: true, message: '是否第三方采购不能为空', trigger: 'blur' }
        ],
      },
      addRowData:{
        isSelected: true,id: null, orderId: null, goodsId: null, goodsCode: null, goodsName: null, barcode: null, boxBarcode: null, helpSign: null, model: null, goodsBrandId: null, goodsBrandCode: null, goodsBrandName: null, goodsTypeId: null, goodsTypeCode: null, goodsTypeName: null, goodsTagId: null, goodsTagCode: null, goodsTagName: null, taxId: null, taxCode: null, taxName: null, taxRate: null, firstUnitId: null, firstUnitCode: null, firstUnitName: null, firstUnitCount: null, effectGoodsCount: null, cutOffGoodsCount: null, taxPrice: null, noTaxPrice: null, taxBoxPrice: null, noTaxBoxPrice: null, seq: null, remark: null, createUserId: null, createUserCode: null, createUserName: null, createTime: null, updateUserId: null, updateUserCode: null, updateUserName: null, updateTime: null
      },
      showAddBatchDialog: false,
      productList:[]

    }
  },
  watch: {
  },
  // destroyed() {
  //   this.crud.setItemInfo("wareSplitOrderDetail_add")
  // },
  activated() {
    //获取上次进入Id
    const id = sessionStorage.getItem(this.$options.name + 'Id')
    //记录本次进入的Id
    sessionStorage.setItem(this.$options.name+'Id',this.$route.params.id)
    if (!this.crud.header)this.getHeader()
    if(id !== this.$route.params.id){
      if(this.$route.params.id === 'add'){
        this.$set(this.crud,'order',Object.assign({},this.copyFrom))
        this.crud.data = []
        // this.$set(this.crud,'data',[])
      }else if(this.$route.params.id.indexOf('copy') !== -1){
        const copyId = this.$route.params.id.split('=')[1]
        this.crud.toGetCopyInfo(copyId)
      }else {
        this.crud.params.id = this.$route.params.id
        this.crud.refresh()
      }
    }
  },
  created(){
    const data ={
      modelName:'wareSplitOrderDetail',
      url: "api/wareSplitOrder/detail",
      userId:this.$store.state.user.user.userId,
    }
    this.crud.headerInfo = {
      code:'wareSplitOrderDetail',
      userId:this.$store.state.user.user.userId,
      path: "api/wareSplitOrder/detail",
    }
    if(/add$/.test(window.location.href)){
      getHeaderProperties(data).then(res=>{
        this.crud.header = JSON.parse(res.data.header.content)
        this.$forceUpdate()
      }).catch(err=>{console.log(err)})
    }

    // let id = this.$route.query.id
    // const href = location.href.split('/')
    // if (href[5].includes('copyId')) {
    //   console.log('route.query', this.$route.params)
    //   let  strs = this.$route.params.id.split("=");
    //   this.crud.toGetCopyInfo(strs[1])
    // }
    // if (this.$route.params.id == 'add') {
    //   console.log('cleanItemInfo')
    //   if( this.crud.getItemInfo("wareSplitOrderDetail_add")){
    //     return false
    //   }
      this.crud.order = Object.assign({}, {
        id: null,
        code: '',
        busDate:  this.getTime(),
        // createTime: this.getTime(),
        name: '',
        userId: '',
        locationId:null,
        boxUnitId: '',
        boxUnitName: "",
        locationName:null,
        boxUnitCount:null,
        storehouseId:null,
        storehouseName: null,
        outLocationCode:'',
        outLocationId:'',
        outLocationName:'',
        inLocationCode:'',
        inLocationId:'',
        inLocationName:'',
        usableNum: null,
        deptId: null,
        type: 1,
        buyChannel: '1',
        acceptDate: null,
        isContact: null,
        isAppend: 0,
        orderStatus: 'SAVE',
        index: '0',
        customerId:'',
        contactName:'',
        contactPhone:'',
        startDate: null,
        endDate: null,
        taxPrice:null,
        goodsId: '',
        goodsName: '',
        goodsCount: 0,
        taxAmount: 0,
        remark: '',
        mainUnitId: '',
        mainUnitName: '',
        mainNum: null,
        boxNum: null,
        boxCount: null,
        taxBoxPrice: null
      })
      this.copyFrom = Object.assign({},this.crud.order)
    // }
  },
  beforeUpdate() {
    if (this.$route.params.id != 'add') {
      this.id = this.$route.params.id
      this.query.id = this.id
      this.crud.order.id = this.id
    }
  },
  methods: {
    changeNum(num){
      if(num == 1){
        this.crud.order.boxCount = parseInt(Number( this.crud.order.goodsCount || 0) /Number( this.crud.order.boxUnitCount || 0))
        this.crud.order.mainNum = Number( this.crud.order.goodsCount || 0) %Number( this.crud.order.boxUnitCount || 0)
        this.crud.order.taxAmount = (Number( this.crud.order.mainNum || 0) *Number( this.crud.order.taxPrice || 0)
          +
          Number( this.crud.order.boxCount || 0) *Number( this.crud.order.taxBoxPrice || 0)).toFixed(6)
        console.log(this.crud.order.taxAmount)
      }
      if(num == 2){
        this.crud.order.taxAmount = (Number(this.crud.order.taxPrice || 0) * Number(this.crud.order.goodsCount || 0)).toFixed(6)
        // this.crud.order.taxAmount = (Number( this.crud.order.mainNum || 0) *Number( this.crud.order.taxPrice || 0)).toFixed(6)+
        //   (Number( this.crud.order.boxCount || 0) *Number( this.crud.order.taxBoxPrice || 0)).toFixed(6)
        this.crud.order.taxBoxPrice = (Number( this.crud.order.taxPrice || 0) *Number( this.crud.order.boxUnitCount || 0)).toFixed(6)

      }
      if(num == 3){
        this.crud.order.taxBoxPrice = (Number( this.crud.order.taxPrice || 0) *Number( this.crud.order.boxUnitCount || 0)).toFixed(6)
        this.crud.order.taxPrice = (Number( this.crud.order.taxAmount || 0) /Number( this.crud.order.goodsCount || 0)).toFixed(6)
      }

      if(num == 4){
        this.crud.order.taxAmount = (Number( this.crud.order.mainNum || 0) *Number( this.crud.order.taxPrice || 0)+
          Number( this.crud.order.boxCount || 0) *Number( this.crud.order.taxBoxPrice || 0)).toFixed(6)
        this.crud.order.taxPrice = (Number( this.crud.order.taxBoxPrice || 0) /Number( this.crud.order.boxUnitCount || 0)).toFixed(6)

      }
      if(num == 5){
        this.crud.order.goodsCount = Number( this.crud.order.boxCount || 0) *Number( this.crud.order.boxUnitCount || 0) +Number( this.crud.order.mainNum || 0)
        this.crud.order.taxAmount = (Number( this.crud.order.taxPrice || 0) *Number( this.crud.order.goodsCount || 0)).toFixed(6)
      }
    },
    getInfoInWare(e){
      this.crud.order.inWarehouseId = e.id

      this.crud.order.deptId = e.deptId
      this.crud.order.deptId = e.deptId
      this.crud.order.userId = e.userId
    },
    getInfoOutWare(e){
      this.crud.order.outWarehouseId = e.id
      this.crud.order.deptId = e.deptId
      this.crud.order.deptId = e.deptId
      this.crud.order.userId = e.userId
    },
    afterChangeGoods(goods) {
      this.showAddBatchDialog = false
      //去重，已经去重
      let arr = this.crud.data.map(detail=>detail.goodsId)
      let _goods = []
      let result = []
      goods.forEach(good => {
        // if(!arr.includes(goods.goodsId)){
        good.isSelected = true
        this.crud.data.push(good)
        // }
      })
      // this.calcuForm()
    },
    toAddList() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          //校验通过
          this.showAddBatchDialog = true
        } else {
          if (!this.crud.order.customerId) {
            this.$message.error("请先选择客户")
          }
          if (!this.crud.order.type) {
            this.$message.error("请先选择销售单类型")
          }
          if (!this.crud.order.buyChannel) {
            this.$message.error("请先选择采购渠道")
          }
        }
      })
    },
    getInfo(e){
      this.crud.order.deptId = e.deptId
      this.crud.order.deptId = e.deptId
      this.crud.order.userId = e.userId
    },
    delAddRow(i){
      if(this.$route.params.id !== 'add'){
        this.$confirm('此操作将直接删除此条产品记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.crud.delRow(i)
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      }else{
        this.crud.delRow(i)
      }
    },
    getValue(e,i){
      console.log('this.crud.data',this.crud.data )
      this.crud.data[i].productName = e
      // let temp = this.crud.data[2]
      // this.crud.data[3] = temp
      this.crud.data.map(item => {
        // item.existId = 0
        // item.existNum = 0
        if(item.existBox === null){
          item.existBox = 0
        }
        if(item.occupyBox === null){
          item.occupyBox = 0
        }
      })
    },
    getInput(e,name,i){
      if(this.crud.data){
        if(e){
          this.crud.data[i].goodsName = ''
          this.crud.data[i].goodsId= e
        }else{
          this.crud.data[i].goodsName = ''
          this.crud.data[i].goodsId= null
        }
      }
    },
    getInputMation(e){
      this.crud.order.boxUnitId = e.boxUnitId
      this.crud.order.boxUnitName = e.boxUnitName
      this.crud.order.mainUnitId = e.mainUnitId
      this.crud.order.boxUnitCount = e.boxUnitCount
      this.crud.order.mainUnitCount = e.mainUnitCount
      this.crud.order.mainUnitName = e.mainUnitName
      this.crud.order.taxPrice = 0
      this.crud.order.taxBoxPrice = 0
      this.crud.order.taxAmount = 0
      this.$forceUpdate()
    },
    // 保存
    submit(){
      console.log('当前数量',this.crud.order.goodsCount)
      if (this.crud.order.goodsCount<1){
        Notification.error({title:'辅数量不能小于1'})
        return false
      }
      var oDate1 = new Date(this.crud.order.startDate);
      var oDate2 = new Date(this.crud.order.endDate);
      if(oDate1.getTime() > oDate2.getTime()){
        this.$message({
          message: '开始日期不能大于结束日期',
          type: 'warning'
        })
        this.crud.order.startDate = null
        this.crud.order.endDate = null
        return false
      }
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        const table_rules = [
          {name: '数量', value: 'goodsCount'},
          // {name: '采购价', value: 'taxPrice'},
          // {name: '未税单价', value: 'noTaxPrice'},
          // {name: '含税金额', value: 'taxAmount'},
          // {name: '未税金额', value: 'noTaxAmount'}
        ]
        const result = table_rules.some(({name, value}) => {
          const rules = this.$refs.table.data.some((item, index) => {
            if (!this.tableRules((index + 1), name, item[value])) return true
          })
          if (rules) return true
        })
        if (!result) this.save()
      })
    },
    tableRules(index, name, value) {
      if (!value) {
        Notification.error({title: '序号【' + index + '】' + name + '不能为空'})
        return false
      } else return true
    },
    getTime(date = new Date()){
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? ('0' + m) : m;
      var d = date.getDate();
      d = d < 10 ? ('0' + d) : d;
      var h = date.getHours();
      h=h < 10 ? ('0' + h) : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? ('0' + minute) : minute;
      var second=date.getSeconds();
      second=second < 10 ? ('0' + second) : second;
      // +' '+h+':'+minute+':'+second;
      return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second
    },
    //保存
    save() {
      let that = this
      that.crud.loadingOpen()
      this.crud.order.detailList  = this.crud.data
      let params = this.crud.order
      const href = location.href.split('/')
      if (href[5].includes('copyId')) {
        this.crud.order.id = null
      }
      crudWareSplitOrder.add(params).then(res => {
        if(res.success){
          this.crud.order  = res.data
          // this.crud.data = res.data.detailList
          let id=res.data.id
          if(this.$route.params.id == 'add' || href[5].includes('copyId')){
            // this.$store.dispatch("tagsView/delView", this.$route);
            // this.$router.push({params: {id}})
            // this.crud.cleanItemInfo('wareSplitOrderDetail_add')
            this.$router.replace('/redirect/ware/wareSplitOrderDetail/'+id)
          }
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          that.crud.refresh()
          that.crud.loadingClose()
        }else{
          that.crud.loadingClose()
          this.$message({
            message: res.msg,
            type: 'warning'
          })
        }

      }).catch((res)=>{
        that.crud.loadingClose()
      })
    },
    // 新增
    toAdd(){

      if(!this.crud.order.customerId){
        this.$message({
          message: '请先选择供应商',
          type: 'error'
        })
        return false
      }
      this.crud.data.push({
        isSelected: true,id: null, locationId:null,
        locationName:null,
        storehouseId:null,
        storehouseName: null,
        outLocationCode:'',
        outLocationId:'',
        outLocationName:'',
        inLocationCode:'',
        inLocationId:'',
        inLocationName:'',
        boxUnitId:null,
        boxUnitName: '',
        mainUnitId: '',
        boxUnitCount: '',
        mainUnitCount: '',
        mainUnitName:null,
        usableNum: null,
        orderId: null,
        goodsId: null,
        goodsCode: null,
        goodsName: null,
        barcode: null,
        boxBarcode: null,
        helpSign: null,
        model: null,
        goodsBrandId: null,
        goodsBrandCode: null,
        goodsBrandName: null,
        goodsTypeId: null,
        goodsTypeCode: null,
        goodsTypeName: null,
        goodsTagId: null,
        goodsTagCode: null,
        goodsTagName: null,
        taxId: null,
        taxCode: null,
        taxName: null,
        taxRate: null,
        firstUnitId: null,
        firstUnitCode: null,
        firstUnitName: null,
        firstUnitCount: null,
        effectGoodsCount: null,
        cutOffGoodsCount: null,
        taxPrice: null,
        noTaxPrice: null,
        taxBoxPrice: null,
        noTaxBoxPrice: null,
        seq: null,
        remark: null,
        createUserId: null,
        createUserCode: null,
        createUserName: null,
        createTime: null,
        updateUserId: null,
        updateUserCode: null,
        updateUserName: null,
        updateTime: null,

      })
    },
    //修改
    toDetail(){
    },
    // 获取数据前设置好接口地址
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }, // 新增与编辑前做的操作
    [CRUD.HOOK.afterToCU](crud, form) {
    },

  }
}
</script>

<style scoped>
.table-img {
  display: inline-block;
  text-align: center;
  background: #ccc;
  color: #fff;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  line-height: 32px;
}
</style>

